#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>

#define MAXL 21

typedef struct SNode* PtrToSNode;
typedef enum { lpr, rpr, plus, minus, times, divide, eos, operand } Precedence;
typedef char ElementType;
struct SNode {
    ElementType* Data;
    int Top;
    int Maxsize;
};
typedef PtrToSNode Stack;
Stack CreateStack ( int Maxsize ) {
    Stack S = (Stack)malloc(sizeof(struct SNode));
    S->Data = (ElementType*)malloc(Maxsize*sizeof(ElementType));
    S->Top = -1;
    S->Maxsize = Maxsize;
    return S;
}
bool StackEmpty ( Stack S ) {
    return ( S->Top == -1 );
}
ElementType Peek ( Stack S ) {
    if ( StackEmpty(S) ) {
        printf("Stack Empty\n");
        exit(-1);
    }
    return ( S->Data[S->Top] );
}
bool StackFull ( Stack S ) {
    return ( ( S->Top + 1 ) == S->Maxsize );
}
ElementType Pop ( Stack S ) {
    return ( S->Data[(S->Top)--] );
}
void Push ( Stack S, ElementType X ) {
    if ( StackFull(S) ) {
        printf("Stack Full\n");
        exit(-2);
    }
    S->Data[++(S->Top)] = X;
}

bool IsSign ( char* expr, int i );
char GetOp ( char* expr, int* i, char* Posifix, int* j );
Precedence GetToken ( char op );
void ToPostfix ( char* Expr );

int main () {
    char Str[MAXL];
    gets(Str);
    ToPostfix(Str);
    return 0;
}


void ToPostfix ( char *expr ) {
    int i, j, L;
    char Postfix[2*MAXL], Op;
    Stack S;
    Precedence token;

    S = CreateStack(MAXL);
    L = strlen(expr);
    j = 0;
    for ( i = 0; i < L; i++ ) {
        Op = GetOp(expr, &i, Postfix, &j);
        token = GetToken(Op);
        if ( token == operand ) continue;
        switch (token) {
        case lpr:
            Push(S,'(');
            break;
        case rpr:
            while ( Peek(S) != '(' ) {
                Postfix[j++] = Pop(S);
                Postfix[j++] = ' ';
            }
            Pop(S);
        default:
            while ( !StackEmpty(S) && Peek(S) != '(' && token <= GetToken(Peek(S)) ) {
                Postfix[j++] = Pop(S);
                Postfix[j++] = ' ';
            }
            Push(S,Op);
            break;
        }
    }
    while ( !StackEmpty(S) ) {
        Postfix[j++] = Pop(S);
        Postfix[j++] = ' ';
    }
    Postfix[j-1] = '\0';
    printf("%s\n",Postfix);
}

bool IsSign ( char* expr, int i ) {
    if ( !i || (!isdigit(expr[i-1]) && ( expr[i-1] != ')' ) ) ) return true;
    else return false;
}

char GetOp ( char* expr, int* i, char* Postfix, int* j ) {
    if ( isdigit(expr[*i])) {
        while ( isdigit(expr[*i]) || ( expr[(*i)] == '.' ) ) Postfix[(*j)++] = expr[(*i)++];
        Postfix[(*j)++] = ' ';
        (*i)--;
        return '0';
    }
    switch (expr[(*i)]) {
    case '+':
        if ( IsSign(expr, (*i)) ) {
            (*i)++;
            return GetOp(expr,i,Postfix,j);
        }
        else return '+';
    case '-' :
        if ( IsSign(expr,(*i)) ) {
            Postfix[(*j)++] = '-';
            (*i)++;
            return GetOp(expr,i,Postfix,j);
        } else return '-';
    default :  return expr[(*i)];
    }
}

Precedence GetToken ( char op ) {
    switch (op) {
    case '(': return lpr;
    case ')': return rpr;
    case '+': return plus;
    case '-': return minus;
    case '*': return times;
    case '/': return divide;
    case '\0':return eos;
    default:  return operand;
    }
}